Skip to content

feat(libSceLibreSsl3): implement X509_STORE_CTX_new, free, get0_param and X509_STORE_up_ref - #15544

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
ashwin280802:feat/libressl3-x509-store-ctx
Nov 10, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
ashwin280802:feat/libressl3-x509-store-ctx

Conversation

@ashwin280802

@ashwin280802 ashwin280802 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements four libSceLibreSsl3 exports that threw NotImplemented_nid_no_patch: X509_STORE_CTX_new, X509_STORE_CTX_free, X509_STORE_CTX_get0_param and X509_STORE_up_ref. The module forwards X509_STORE_new, X509_STORE_free and the X509_STORE_CTX_* getters and setters to libSceLibreSsl, so the new code uses that library's layouts: the 136-byte store with references at offset 128 and the 240-byte context.

Source: LibreSSL x509_vfy.c (X509_STORE_CTX_new, X509_STORE_CTX_free, X509_STORE_CTX_cleanup, X509_STORE_CTX_get0_param) and x509_lu.c (X509_STORE_up_ref) at 078b3d1d.

  • X509_STORE_CTX_new returns a zeroed guest-heap context; X509_STORE_CTX_get0_param returns param.
  • X509_STORE_up_ref increments references atomically and returns 1 when the new count is above 1, otherwise 0.
  • X509_STORE_CTX_free ignores null and frees the context. Its cleanup also releases a cleanup callback, an owned verify parameter, the policy tree, the chain and the extra data; those paths throw without changing the context, because the code that releases them is not available here.

Deliberate divergences, recorded in docs/dev/debt/libSceLibreSsl3.md: X509_STORE_CTX_new does not queue ERR_R_MALLOC_FAILURE (the error queue is not modelled), null arguments to get0_param and up_ref throw where LibreSSL dereferences them, and up_ref throws at INT32_MAX.

Open PRs: none implements these four functions; I searched the diffs of the open PRs that touch these files, including the 18 the overlap tool could not compare (#12315, #14465, #14499, #14612, #15163, #15514, #15627, #15629, #15631, #15737, #15758, #15760, #15761, #15765, #15770, #15826, #15831, #15854); git log -G for the four exported names over those PR heads finds no commits. Several touch the same debt file and the test list in CMakeLists.txt, which will need a trivial rebase.

Tested

Windows 11, at 8600542dc5.

ctest --test-dir build-full -R "guest_libressl3_(x509_store_context|x509_verify_param|stack)":

1/3 Test #3273: guest_libressl3_x509_verify_param ....   Passed    0.04 sec
2/3 Test #3274: guest_libressl3_stack ................   Passed    0.02 sec
3/3 Test #3275: guest_libressl3_x509_store_context ...   Passed    0.11 sec
100% tests passed out of 3

The new test covers all four functions, the throwing free paths, leaks and 8 threads x 20000 up_ref calls. tools/check_conventions.py --base origin/main passes.

I changed 17 conditions and statements in the new code one at a time and the test failed on each.

Not covered by a test: allocation failure of X509_STORE_CTX_new.

Not verified: I also ran all the repository's tests on Windows and Linux, and every libSceLibreSsl3 test passed; the only failures were select_tests_MissingCommandTests, vulkan_validation_gate_commands and guest_mmap_executable, which fail on main on this machine too. Nothing was run on a console, and the 240-byte context and 136-byte store layouts of the console's libSceLibreSsl3 are not checked against it.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Progress report (df8dbb0 → 18585c7)

📈 System libraries: 35.75% (+0.0078%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceLibreSsl3 X509_STORE_CTX_get0_param_nid_postfix
libSceLibreSsl3 X509_STORE_CTX_new_nid_postfix
libSceLibreSsl3 X509_STORE_up_ref_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl3 514/680 (75.59%) 517/680 (76.03%) +0.44%

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head feec18a merged onto main 1c8c0ef · tested 2026-11-04 05:28 UTC · 21 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 1,129 passed · 4 failed (0 new, 3 also fail on main, 1 unstable on main) · 7 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 1,140 of 3,842 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (549 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ public_headers 41.7 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 8 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
agc_driver_native_depth_bda_clear
agc_driver_native_multisample_depth
Validation IDs already present on main (8 IDs in 470 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (470 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 462 more
VUID-vkCmdCopyImage-srcImage-01548 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_srgb8_color_target
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (7)
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
Reproduce
git fetch origin feec18acc64699910a3854ecad8e136997892de0 1c8c0efc8c41314402e6966da5bef6ea3d639d10
git checkout 1c8c0efc8c41314402e6966da5bef6ea3d639d10 && git merge --no-ff feec18acc64699910a3854ecad8e136997892de0
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@ashwin280802
ashwin280802 force-pushed the feat/libressl3-x509-store-ctx branch from feec18a to 771a4e4 Compare November 4, 2026 17:47
@ashwin280802

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main (9ab6a28), cleanly resolving conflicts with #10557. Conventions checks and unit tests pass.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 4, 2026
@ashwin280802
ashwin280802 force-pushed the feat/libressl3-x509-store-ctx branch from 771a4e4 to bd911ad Compare November 6, 2026 15:36
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 15591 docs/dev/debt/libSceLibreSsl3.md L82, L103-104
PR 15831 docs/dev/debt/libSceLibreSsl3.md L82
PR 16535 docs/dev/debt/libSceLibreSsl3.md L19
PR 16654 docs/dev/debt/libSceLibreSsl3.md L19
PR 16689 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L87-94
core/libs/prx/libSceLibreSsl3/include/Api.hpp L309-310
docs/dev/debt/libSceLibreSsl3.md L82
PR 16742 docs/dev/debt/libSceLibreSsl3.md L19
PR 17124 docs/dev/debt/libSceLibreSsl3.md L82
PR 17147 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L87-94
core/libs/prx/libSceLibreSsl3/include/Api.hpp L309-310
docs/dev/debt/libSceLibreSsl3.md L82
PR 17246 docs/dev/debt/libSceLibreSsl3.md L82
PR 17528 docs/dev/debt/libSceLibreSsl3.md L19, L78-79, L82

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14212 docs/dev/debt/libSceLibreSsl3.md
PR 14465 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15163 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16529 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16543 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16586 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16589 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16819 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16848 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16918 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16977 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16979 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16980 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16981 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16996 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17621 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17622 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17626 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md

@adriadam10 adriadam10 self-assigned this Nov 7, 2026
@adriadam10
adriadam10 force-pushed the feat/libressl3-x509-store-ctx branch from bd911ad to 933c089 Compare November 7, 2026 08:05
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@ashwin280802
ashwin280802 force-pushed the feat/libressl3-x509-store-ctx branch from 933c089 to 36655ae Compare November 7, 2026 12:28
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@adriadam10
adriadam10 force-pushed the feat/libressl3-x509-store-ctx branch from 36655ae to d964de8 Compare November 7, 2026 13:03
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 7, 2026
@ashwin280802
ashwin280802 force-pushed the feat/libressl3-x509-store-ctx branch from d964de8 to a1111c4 Compare November 8, 2026 15:17
@B-Howell

B-Howell commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

I prepared a merge of main for your a1111c46 at unstick/pr-15544. The merge at 4bb45c59 resolves the CMake and debt conflicts. X509 store-context and HMAC tests each passed 3/3 on Windows and WSL, and all 65 public-header checks passed on both.

AI-assisted: yes (Codex).

… and X509_STORE_up_ref

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@adriadam10
adriadam10 force-pushed the feat/libressl3-x509-store-ctx branch from a1111c4 to 18585c7 Compare November 10, 2026 04:23
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
@adriadam10
adriadam10 merged commit 9163fe9 into boykopovar:main Nov 10, 2026
13 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the four exports against LibreSSL x509_vfy.c/x509_lu.c and libSceLibreSsl's layouts (up_ref returns count > 1, free throws before touching a context with owned state), and the new test's edge rows (0, negative, INT32_MAX, 8 threads). The branch conflicted with main in CMakeLists.txt and docs/dev/debt/libSceLibreSsl3.md; I rebased it keeping both sides, set the unimplemented-exports count to the real table size (105 entries, 96 named), and the libSceLibreSsl3 tests pass; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants